package edu.neusoft.sa.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import edu.neusoft.sa.entity.Story;
import edu.neusoft.sa.service.StoryService;

@Controller
public class IndexController {
	
	@Autowired
	StoryService storyService;
	
	@RequestMapping(value="/")
	public String index(){
			return "/index";
	}
	
	@ModelAttribute("stories")
	public Story[] getStories(){		
		return storyService.findAllPublished();
	}

	
	

}
